Quiz III (Thursday April 09)

Conditional + repetition statements
Reading from and writing to files

- Method decomposition (Divide and conquer)

Main problem ----> multiple subproblems

Method handling the main problem is replaced with multiple smaller submethods that 
would tackle the smaller problems (subproblems)

Reduce ---> 1) Find the GCD; 2) Use that GCD to simplify the rational number
---> Supporting method was created (findGCD)

- PigLatin translator

enough ---> enoughyay
happy ---> appyhay

Application#1: 
PigLatinDriver.java
PigLatingTranslator.java

Aim: tanslate an English sentence into Pig Latin
Step#1: Decomposing the sentence into words
Step#2: Translate the individual words 
Step#3: Check whether the word begins with a vowel or not 

------------------------------End of Chapter 7 (Class Relationships)---------------------------

Arrays (Elementary data structure but very powerful)

1. Declare the array 
double[] grades or double grades[] (go with syntax to declare arrays)

main(String args[])


double grades[], foo; // Only grades is an array

double[] grades, foo; // both grades and foo are arrays in this case

2. Instantiate the array

double[] grades;

grades = new double[34];

grades:
0				....	33
0.0	0.0	0.0	0.0		0.0


Application#2: 
ArrayDemo.java

Aim: Create an array of int values and then populate with 15 succesive increments of 10 

When it comes to Strings, we use methods to access the individual characters. In the case
of arrays, we use the [] operator to access the array elements. 

String str = "Ipsum"; System.out.println(str.length()); // length here is a method
int[] arr = new int[10]; System.out.println(arr.length); // length here is not a method


Application#3: 
ReverseOrder.java

Get 5 values from the user and print them in reverse order

1
2
3
4
5
5	4	3	2	1

Application#4: 
ArraysManipulation.java








